#ifndef HUD_BUTTON_H
#define HUD_BUTTON_H
#include "../core/screen.h"
#include "../affiliate/sprite.h"
class hudButton : public screen {
protected:
    sprite *sp_normal = nullptr;
    sprite *sp_hover = nullptr;
    sprite *sp_press = nullptr;
    bool isHover = false;
    bool isPress = false;
    bool isTrigger = false;
public:
    static hudButton* createHUDButton(node *parent,glm::vec2 pos,const char* name, const char* normalPath,
        const char* hoverPath,const char* pressPath,float scale = 1.0f,Anchor anchor = Anchor::ANCHOR_CENTER);
    sprite *getSpriteNormal()const{ return sp_normal; };
    sprite *getSpriteHover()const{ return sp_hover; };
    sprite *getSpritePress()const{ return sp_press; };
    void setSpriteNormal(sprite *sp){ sp_normal = sp; };
    void setSpriteHover(sprite *sp){ sp_hover = sp; };
    void setSpritePress(sprite *sp){ sp_press = sp; };
    void setScale(float scale);
    //float getScale()const{ return sp_normal->getPreScale(); };
    bool getIsHover()const{ return isHover; };
    bool getIsPress()const{ return isPress; };
    bool getIsTrigger();//只会触发一次，然后重置isTrigger

    virtual bool handleEvents(SDL_Event& event) override;
    virtual void update(float delta) override;
    void checkHover();
    void checkState();
};

#endif  // HUD_BUTTON_H